home *** CD-ROM | disk | FTP | other *** search
- Path: po.CWRU.Edu!mab22
- From: mab22@po.CWRU.Edu (Michael A. Balfour)
- Newsgroups: comp.lang.c
- Subject: Re: String Arrays and string parsing
- Date: 20 Feb 1996 22:47:59 GMT
- Organization: Case Western Reserve University, Cleveland, OH (USA)
- Message-ID: <4gdj2v$bb1@madeline.INS.CWRU.Edu>
- References: <31287278.789445@news.inforamp.net>
- Reply-To: mab22@po.CWRU.Edu (Michael A. Balfour)
- NNTP-Posting-Host: kanga.ins.cwru.edu
-
-
- In a previous article, dsheuman@inforamp.net (Danny Heuman) says:
-
- >I have day, month, and year as DDMMMYYYY and would like to parse it
- >out in to DD, MMM, YYYY. I can parse the DD out by using
- >strncpy(into1, from1, 2). I can parse the YYYY out by doing
- >strcpy(into3, from1 + 5). How can I parse out the MMM? Can I use
- >either of these functions that work above, strncpy or strcpy? If so,
- >once parsed, do I have to attach an '\0' to the end of it to keep it
- >as a character string?
- >
- How about strncpy(into2, from1 + 2, 3)? You will have to attach an '\0'
- to into1 and into2. Not too difficult, though:
- into1[2]=into2[3]='\0';
-
- Mike Balfour
- --
- ----------------------------------+--------------------------------
- Mike Balfour, Partner | BS/MS Graduate - ECMP
- Overload Engineering | Case Western Reserve University
- "New Ideas for a Brighter Future" | Cleveland, OH
-